
var db = require("./dbHelper.js");

//移动端


//评论——qp
exports.posttalk = function(req,res){
    console.log("进到control了1");
    var face = req.body.text1,
        name = req.body.text2,
        talk = req.body.text3,
        time = req.body.text4,
        num = req.body.text5;

    db.open();
    db.posttalk_db(face,name,talk,time,num,res);
    db.end();
};
//注册——查询——qp
exports.postseachuser = function(req,res){
    console.log("进到control了2");
    var name = req.body.text1;
    console.log(name);
    db.open();
    db.postseachuser_db(name,res);
    db.end();
};
//注册——添加新用户——qp
exports.postadduser = function(req,res){
    console.log("进到control了3");
    var name = req.body.text1,
        pass=req.body.text2;
    db.open();
    db.postadduser_db(name,pass,res);
    db.end();
};
//登录——qp
exports.postloginuser = function(req,res){
    console.log("进到control了4");
    var name = req.body.text1,
        pass = req.body.text2;
    db.open();
    db.postloginuser_db(name,pass,res);
    db.end();
};
//刷新——qp
exports.postupdata = function(req,res){
    console.log("进到control了5");
    db.open();
    db.postupdata_db(req,res);
    db.end();
};

//刷新0518——qp
exports.uploadUserinfo = function(req,res){
    console.log("进到control了5");
    var name = req.body.text1;
    db.open();
    db.uploadUserinfo_db(name,res);
    db.end();
};


//PC端

//注册——查询——qp
exports.postseachuser_PC = function(req,res){
    console.log("进到control了1PC");
    var name = req.body.text1;
    console.log(name);
    db.open();
    db.postseachuser_PC_db(name,res);
    db.end();
};
//注册——添加新用户——qp
exports.postadduser_PC = function(req,res){
    console.log("进到control了2PC");
    var name = req.body.text1,
        pass=req.body.text2;
    db.open();
    db.postadduser_PC_db(name,pass,res);
    db.end();
};
//登录——qp
exports.postloginuser_PC = function(req,res){
    console.log("进到control了3PC");
    var name = req.body.text1,
        pass = req.body.text2;
    db.open();
    db.postloginuser_PC_db(name,pass,res);
    db.end();
};


//评论——qp
exports.posttalk_PC = function(req,res){
    console.log("进到control了1");
    var face = req.body.text1,
        name = req.body.text2,
        talk = req.body.text3,
        time = req.body.text4,
        num = req.body.text5;

    db.open();
    db.posttalk_db(face,name,talk,time,num,res);
    db.end();
};
//刷新——qp
exports.postupdata_PC = function(req,res){
    console.log("进到control了5");
    db.open();
    db.postupdata_PC_db(req,res);
    db.end();
};
//点赞——qp
exports.postdianzan = function(req,res){
    console.log("进到control了5");
    var id = req.body.text1;
    db.open();
    db.postdianzan_db(id,res);
    db.end();
};

//李梦辉
exports.spotSee = function(res,req){
    db.open();
    var sql = "select * from spot_s where dest_key=1;";
    db.spotSeeDB(sql,req);
    db.end();
};

//images
exports.images = function(req,res){
    console.log("图片");
    res.send(dstPath[0].path);
};